package blackhouse_dao;

import java.sql.SQLException;
import java.util.List;

import blackhouse_entity.ResultBean;

public class addresult_dao extends jdbc_dao
{
	public int addresult_dao(List<ResultBean> resultInfo) throws SQLException
	{
		int num = 0;
		for (ResultBean info : resultInfo)
		{
			if (info.getSid() == 0 || info.getSubid() == 0)
			{
				continue;
			}
			// 可拼接字符串
			StringBuffer value = new StringBuffer();
			value.append("'" + info.getSubid() + "'").append(",");
			value.append("'" + info.getSid() + "'").append(",");
			value.append("'" + info.getResult() + "'");
			// 传数据导jdbc，再从jdbc传到数据库运行SQL语句存入数据
			String sql = "insert into `result` (`subid`, `sid`, `result`) values ("
					+ value.toString() + ")";
			num = update(sql);
		}
		return num;
	}
}
